<?php
$sort_array = [
	"array1" => [
		'word'       => 'test1' ,
		'sortnumber' => 1 ,
	] ,
	'array3' => [
		'word'       => 'test4' ,
		'sortnumber' => 4 ,
	] ,
	'array2' => [
		'word'       => 'test3' ,
		'sortnumber' => 3 ,
	] ,
	'array5' => [
		'word' => 'test5' ,
	] ,
	'array4' => [
		'word'       => 'test2' ,
		'sortnumber' => 2 ,
	] ,
];
// 自定义排序函数.$a循环对比的前一项，$b后一项
function my_sort($a,$b){
	$prev = isset($a['sortnumber']) ? $a['sortnumber'] : 0;
	$next = isset($b['sortnumber']) ? $b['sortnumber'] : 0;
	if($prev == $next)return 0;
	return ($prev<$next) ? -1 : 1;
}
function my_rsort($a,$b){
	$prev = isset($a['sortnumber']) ? $a['sortnumber'] : 0;
	$next = isset($b['sortnumber']) ? $b['sortnumber'] : 0;
	if($prev == $next)return 0;
	return ($prev<$next) ? 1 : -1;
}
echo '<pre>排序前:<br>';
print_r($sort_array);
uasort($sort_array, "my_sort");
echo "排序后:<br>";
print_r ($sort_array);
echo "排序后:<br>";
uasort($sort_array, "my_rsort");
print_r ($sort_array);